<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/classes/DBHelper.class.jsp" %>
<%@ include file="/classes/CommonHelper.class.jsp" %>
<%@ include file="/common/basePath.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String guid = getParameter(request,"guid");
	if(nullOrEmpty(guid)){
		out.println("<script>alert(\"参数错误！\");");
		out.println("window.location.href = 'zspj_list.jsp';</script>");
		return;
	}
	
	String sql = "select * from APP_ZSPJ where guid = ?";
	Map<String,Object> m = getObject(sql,new Object[]{guid});
	//查询分类
	String sqlList = "select * from APP_ZSPJ_TYPE order by order_num";
	List<Map<String,Object>> list = queryForList(sqlList);
	
	pageContext.setAttribute("m",m);
	pageContext.setAttribute("list",list);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="../js/jquery-1.7.min.js"></script>
<script type="text/javascript" src="../js/jquery.form.js"></script>
<script type="text/javascript">

function toSubmit(){
	if($("#question").val()==""){
		alert("请输入问题？");
		return false;
	}
	if($("#answer").val()==""){
		alert("请输入答案？");
		return false;
	}
	if($("#answer").val().length>2000){
		alert("答案长度不能超过2000个字？");
		return false;
	}
	$("#submit").attr("disabled","disabled");
	return true;
}
</script>
<link rel="stylesheet" type="text/css" href="../css/mytable.css"></link>
</head>
<body>
<form id="myForm" action="zspj_modifydo.class.jsp?r=<%=new Date().getTime() %>" method="post" onsubmit="return toSubmit()">
	<table id="mytable" cellspacing="0" summary="The technical specifications of the Apple PowerMac G5 series"> 
		<caption> </caption> 
		<tr>
			<th scope="col"  class="nobg"></th>
			<th class="nobg">
				知识普及--修改
			</th>
		</tr>
		<tr>
			<th scope="col">类别：</th>
			<td class="specalt">
				<select name="type_id"  style="width: 200px">
					<c:forEach items="${list }" var="type">
					<option value="${type.guid }" <c:if test="${type.guid==m.type_id }">selected="selected"</c:if> >${type.type_name }</option>
					</c:forEach>
				</select>
			</td>
		</tr>
		<tr>
			<th scope="col">问题：</th>
			<td class="specalt">  <input type="text" name="question" value="${m.question }" style="width: 200px" /> </td>
		</tr>
		<tr>
			<th scope="col">答案：</th>
			<td class="specalt"> <textarea id="answer" name="answer" style="width: 400px;height: 150px" >${m.answer }</textarea> </td>
		</tr>
		<tr>
			<th scope="col">提供部门名称：</th>
			<td class="specalt">
			<input type="text" name="dept_name" value="${m.dept_name }" style="width: 200px" />
			</td>
		</tr>
		<tr>
			<th scope="col">
				<input type="hidden" name="guid" value="${m.guid }" />
			</th>
			<td class="specalt"> <input id="submit" type="submit" value="提交" /> 
			<input type="button" value="返回列表页"  onclick="window.location.href='zspj_list.jsp?r=<%=new Date().getTime() %>'"/>
			</td>
		</tr>
	</table>
</form>
</body>
</html>